#pragma once

#define TEMPLATE template<typename T>
#define VECTOR2 Vector2T<T>

BEGIN_NAMESPACE_OXGE


TEMPLATE
const VECTOR2 VECTOR2::ZERO(0,0);

TEMPLATE
const VECTOR2 VECTOR2::UNIT_X(1,0);

TEMPLATE
const VECTOR2 VECTOR2::UNIT_Y(0,1);

TEMPLATE
const VECTOR2 VECTOR2::UNIT_SCALE(1,1);


TEMPLATE
std::ostream& operator<<(std::ostream& os, VECTOR2 vec)
{
	os << "(";
	size_t i = 0;
	for(;i<vec.NLen-1;++i)
	{
		os << vec[i] << ',';
	}
	os << vec[i] ;
	os << ")";
	return os;
}


TEMPLATE
void VECTOR2::UnitTest()
{
	T cvArray[] = { 1,2,3 };
	VectorType vec;
	VectorType vec1(1,1);
	VectorType vec2(cvArray);

	vec.Set(2,3).Set(cvArray);
	vec*=3;
	vec+=vec1;
	vec-=vec2;

	vec1 + vec2;
	vec1 - vec2;
	vec1 * 3;
	3 * vec1;

	vec[1];

	vec1.dot(vec2);
	vec1.cross();
	vec1.Normalize();
	vec1.SquareLength();
	vec1.Length();
	vec1.SetLength(3);
	vec1.GetNormVector();

	vec2 = ZERO;
	vec2 = UNIT_X;
	vec2 = UNIT_Y;
	vec2 = UNIT_SCALE;
	
}


END_NAMESPACE_OXGE


#undef TEMPLATE
#undef VECTOR2